package com.example.alibabavodossservice.vod.media;

import com.example.alibabavodossservice.CheckTools;
import com.example.alibabavodossservice.vod.BaseUploadParameter;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * desc:上传媒体附件参数
 *
 * @author xugenyin
 */
@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class AttachedMediaParameter extends BaseUploadParameter {

    /**
     * 业务类型
     */
    private String businessType;
    /**
     * 文件扩展名
     */
    private String mediaExt;
    /**
     * 源文件名
     */
    private String fileName;

    /**
     * 检查必要参数
     *
     * @param param param
     */
    public static void checkMustParam(AttachedMediaParameter param) {
        if (CheckTools.isNullOrEmpty(param.getBusinessType()) || CheckTools.isNullOrEmpty(param.getMediaExt())) {
            throw new IllegalArgumentException("业务类型和文件扩展名不能为空");
        }
    }
}
